Nested Lists


What are Nested Lists?

A nested list is a list placed inside another list. This is a fundamental feature of HTML that allows you to create hierarchical structures for your content, similar to an outline. You can nest either an ordered list <ol > or an unordered list <ul> inside a list item <li > of a parent list.

The browser automatically handles the indentation and styling to visually represent the nesting. For an ordered list, it might continue the numbering or use a different numbering scheme, while an unordered list might use a different bullet style.


How to Create Nested Lists

To create a nested list, you simply start a new <ul > or <ol > tag within a list item <li> of an existing list. The entire nested list block is considered part of the parent list item.


Example of an Unordered Nested List

This example shows how to list different types of tea under a main "Tea" category using an unordered list. Notice how the inner <ul> is placed inside the <li> for "Tea".

unordered list example

Example of an Ordered Nested List

This example demonstrates a multi-step process where one of the steps has its own sub-steps. An ordered list is used for the main steps, with another ordered list nested inside the second list item.

ordered list example

Tables

What are Tables?

An HTML table is used to display data in a structured way, using rows and columns. Tables are essential for presenting information like financial data, calendars, and product listings in a clear, organized format.

A table is defined by the <table> tag. It is divided into table rows (<tr>), and each row contains table data (<td>) or table headers (<th>).


Table Tags

The main tags used to build a table are:


Example of a table

table example

Colspan and Rowspan

HTML Table - Colspan

To make a cell span over multiple columns, use the colspan attribute

colspan example

HTML Table - Rowspan

To make a cell span over multiple rows, use the rowspan attribute

rowspan example